using System;
using System.ComponentModel.DataAnnotations;
using BLL.Services.Comments;
using Web.Infrastructure.Models;

namespace Web.Areas.Admin.Models.Comments
{
    public class CommentCreateModel : BaseModel
    {
        public CommentCreateModel(Comment comment)
        {
            ToModel(comment, this);
        }

        public CommentCreateModel()
        {
        }

        public static explicit operator Comment(CommentCreateModel model)
        {
            var comment = new Comment();
            ToEntity(model, comment);
            return comment;
        }

        [Required]
        [UIHint("MultilineText")]
        [StringLength(1000)]
        [Display(Name = "Description")]
        public string Description { get; set; }

        [Required]
        [Display(Name = "Date Of Publish")]
        public DateTime DateOfPublish { get; set; }

        [Required]
        [Range(1, int.MaxValue, ErrorMessage = "Please select user.")]
        [Display(Name = "User")]
        [UIHint("select")]
        public int UserId { get; set; }

        [Required]
        [Range(1, int.MaxValue, ErrorMessage = "Please select ResponseId.")]
        [Display(Name = "Response Id")]
        public int ResponseId { get; set; }
    }
}